(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     42555,        953]
NotebookOptionsPosition[     41600,        920]
NotebookOutlinePosition[     42034,        939]
CellTagsIndexPosition[     41991,        936]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell[BoxData[
 StyleBox["\:5149\:8def\:53ef\:89c6\:5316", "Title"]], "Input",
 CellFrame->{{0, 0}, {0.5, 0}},
 CellGroupingRules->{"GroupTogetherGrouping", 10000.},
 CellChangeTimes->{{3.817331932618697*^9, 3.8173319460104628`*^9}, 
   3.817348546926899*^9, {3.817357762925655*^9, 3.8173577657199345`*^9}, 
   3.817521823174597*^9, 3.817616139023605*^9, 3.817618174598412*^9, 
   3.817690181898816*^9, 3.8177897710308266`*^9, {3.817966114956794*^9, 
   3.817966134730771*^9}, {3.8181309248537493`*^9, 3.8181309299042544`*^9}},
 TextAlignment->Center],

Cell[CellGroupData[{

Cell[BoxData[
 StyleBox["\:5b9a\:4e49\:573a\:666f", "Subsection"]], "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.},
 CellChangeTimes->{{3.8173319710178933`*^9, 3.8173319847946815`*^9}, 
   3.817332046959237*^9, 3.8173485841018457`*^9, 3.817348654194854*^9, {
   3.8173586705394073`*^9, 3.817358672035557*^9}, 3.8174156245735397`*^9, {
   3.817415663231971*^9, 3.8174156701883745`*^9}},
 TextAlignment->Center],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{"sphere", "[", 
     RowBox[{
     "center_", ",", "radius_", ",", "type_", ",", "fuzzy_", ",", "color_", 
      ",", "refractive_"}], "]"}], ":=", 
    RowBox[{"(", 
     RowBox[{"{", 
      RowBox[{
      "center", ",", "radius", ",", "type", ",", "fuzzy", ",", "color", ",", 
       "refractive"}], "}"}], ")"}]}], ";"}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
   "\:539f\:70b9", "\:ff0c", "\:4e5f\:662f\:76f8\:673a\:6240\:5728\:70b9"}], 
   "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"origin", " ", "=", " ", 
    RowBox[{"{", 
     RowBox[{"0", ",", "0", ",", "0"}], "}"}]}], ";"}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
   "\:751f\:6210\:7684\:76ee\:6807\:56fe\:7247\:7684\:5c3a\:5bf8", "\:ff0c", 
    "\:5355\:4f4d\:662f\:50cf\:7d20"}], "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"width", "=", "120"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"height", "=", "60"}], ";"}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
   "\:5c4f\:5e55\:4f4d\:7f6e", "\:ff0c", 
    "\:56db\:4e2a\:89d2\:7684\:5750\:6807"}], "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"upperLeft", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"-", "2"}], ",", "1", ",", 
     RowBox[{"-", "1"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"upperRight", "=", 
   RowBox[{"{", 
    RowBox[{"2", ",", "1", ",", 
     RowBox[{"-", "1"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"lowerLeft", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"-", "2"}], ",", 
     RowBox[{"-", "1"}], ",", 
     RowBox[{"-", "1"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"lowerRight", "=", 
    RowBox[{"{", 
     RowBox[{"2", ",", 
      RowBox[{"-", "1"}], ",", 
      RowBox[{"-", "1"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
   "\:5b9a\:4e493\:4e2a\:7403\:4f53", "\:ff0c", 
    "\:5206\:522b\:662f\:73bb\:7483", "\:3001", "\:6f2b\:53cd\:5c04", 
    "\:3001", "\:91d1\:5c5e"}], "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"sphere1", "=", 
   RowBox[{"sphere", "[", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{
       RowBox[{"-", "1"}], ",", "0", ",", 
       RowBox[{"-", "1"}]}], "}"}], ",", "0.5", ",", "\"\<dielectric\>\"", 
     ",", "0", ",", 
     RowBox[{"{", 
      RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", "1.5"}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"sphere2", "=", 
   RowBox[{"sphere", "[", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"0", ",", "0", ",", 
       RowBox[{"-", "1"}]}], "}"}], ",", "0.5", ",", "\"\<metal\>\"", ",", 
     "0.5", ",", " ", 
     RowBox[{"{", 
      RowBox[{"0.8", ",", "0.3", ",", "0.3"}], "}"}], ",", "0"}], "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"sphere3", "=", 
    RowBox[{"sphere", "[", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{"1", ",", "0", ",", 
        RowBox[{"-", "1"}]}], "}"}], ",", "0.5", ",", "\"\<metal\>\"", ",", 
      "0", ",", " ", 
      RowBox[{"{", 
       RowBox[{"0.8", ",", "0.6", ",", "0.2"}], "}"}], ",", "0"}], "]"}]}], 
   ";"}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
   "\:5b9a\:4e49\:53e6\:4e00\:4e2a\:7403\:4f53", "\:ff0c", 
    "\:4f5c\:4e3a\:5730\:9762"}], "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"sphere0", "=", 
    RowBox[{"sphere", "[", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{"0", ",", 
        RowBox[{"-", "100.5"}], ",", 
        RowBox[{"-", "1"}]}], "}"}], ",", "100", ",", "\"\<metal\>\"", ",", 
      "1", ",", 
      RowBox[{"{", 
       RowBox[{"0.8", ",", "0.8", ",", "0.0"}], "}"}], ",", "0"}], "]"}]}], 
   ";"}], "\[IndentingNewLine]", 
  RowBox[{"(*", 
   RowBox[{
    RowBox[{
    "\:5b9a\:4e49\:4e00\:4e2a", "\"\<\:4e16\:754c\>\"", "\:6570\:7ec4"}], 
    "\:ff0c", "\:628a\:7269\:4f53\:653e\:8fdb\:6765"}], 
   "*)"}]}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"world", "=", 
   RowBox[{"{", 
    RowBox[{"sphere0", ",", "sphere1", ",", "sphere2", ",", "sphere3"}], 
    "}"}]}], ";"}], "\[IndentingNewLine]"}], "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.},
 CellChangeTimes->{{3.8173320303312855`*^9, 3.8173320469602365`*^9}, {
   3.8173320976091337`*^9, 3.817332104687539*^9}, 3.8173327535876536`*^9, {
   3.817334078691467*^9, 3.817334078870999*^9}, {3.817334401593808*^9, 
   3.817334545305629*^9}, 3.8173353934318776`*^9, 3.817335450314565*^9, {
   3.8173371538839054`*^9, 3.817337165772094*^9}, {3.817337391527667*^9, 
   3.8173374670579495`*^9}, 3.8173485841018457`*^9, {3.817354088726267*^9, 
   3.81735411975737*^9}, {3.8173578229806595`*^9, 3.8173578388682485`*^9}, {
   3.817357998663226*^9, 3.817358040338393*^9}, {3.8173585716345177`*^9, 
   3.817358615119866*^9}, 3.8174156245735397`*^9, {3.817415663231971*^9, 
   3.8174156701883745`*^9}, {3.817417981841733*^9, 3.8174179859098587`*^9}, 
   3.817419855445687*^9, {3.8174206474975386`*^9, 3.817420649343106*^9}, {
   3.8175246100955315`*^9, 3.8175246885613775`*^9}, {3.8175247358871098`*^9, 
   3.817524736704191*^9}, {3.8175267782593307`*^9, 3.8175267854930544`*^9}, {
   3.81752683014952*^9, 3.8175268588203864`*^9}, 3.817531663891855*^9, 
   3.8175321000704684`*^9, {3.817533784172277*^9, 3.8175338398218412`*^9}, 
   3.81753387771063*^9, 3.8175339468135395`*^9, {3.8175353366615105`*^9, 
   3.8175353385727015`*^9}, {3.817535379122756*^9, 3.8175354017130146`*^9}, {
   3.8175976803041363`*^9, 3.8175976829484005`*^9}, {3.817605073461396*^9, 
   3.8176050950825586`*^9}, {3.8176903015387793`*^9, 
   3.8176903354971747`*^9}, {3.817691186614278*^9, 3.8176911916617823`*^9}, {
   3.8176912344660625`*^9, 3.8176912347020864`*^9}, {3.8176912718478003`*^9, 
   3.817691283185934*^9}, {3.817691326101225*^9, 3.8176914128318977`*^9}, {
   3.817691847060316*^9, 3.8176919379053993`*^9}, 3.8176961701005907`*^9, {
   3.8177775095841255`*^9, 3.817777524896126*^9}, {3.817777557286126*^9, 
   3.817777604671126*^9}, {3.8177783212379384`*^9, 3.817778324974312*^9}, {
   3.8177783755723715`*^9, 3.817778378248639*^9}, {3.817778708599671*^9, 
   3.817778711710982*^9}, {3.817778866898499*^9, 3.817778870244834*^9}, {
   3.8177793573335376`*^9, 3.8177793959934034`*^9}, {3.817787910752808*^9, 
   3.817787912223955*^9}, {3.8177897813308563`*^9, 3.817789812436967*^9}, {
   3.817789856734396*^9, 3.81778992688041*^9}, {3.8177901589136114`*^9, 
   3.817790191329852*^9}, 3.817793591939889*^9, {3.8177936351192064`*^9, 
   3.8177937567523685`*^9}, {3.8177939075654483`*^9, 
   3.8177940042261133`*^9}, {3.8177940417808685`*^9, 3.817794118348524*^9}, {
   3.8177941719768867`*^9, 3.8177941911088*^9}, {3.817794222857974*^9, 
   3.817794223693058*^9}, {3.817794281548843*^9, 3.8177943070193896`*^9}, {
   3.8177945740650916`*^9, 3.817794576628348*^9}, {3.817794627901475*^9, 
   3.8177946565753417`*^9}, {3.817865848595995*^9, 3.817865851567292*^9}, {
   3.817866278599991*^9, 3.8178662822713585`*^9}, {3.817866477614891*^9, 
   3.8178664797441034`*^9}, {3.8178815198429956`*^9, 3.817881522814293*^9}, {
   3.8179584448898497`*^9, 3.817958452975658*^9}, {3.817961979962331*^9, 
   3.817961982642599*^9}, {3.8179625736616945`*^9, 3.8179625743107595`*^9}, {
   3.8179656420285053`*^9, 3.8179656461569185`*^9}, 3.818133783971633*^9, {
   3.8183076176992254`*^9, 3.8183076185683126`*^9}, 3.8206312017514343`*^9, {
   3.8206320582860794`*^9, 3.820632060805331*^9}}]
}, Open  ]],

Cell[BoxData[
 StyleBox["\:5b9a\:4e49\:51fd\:6570", "Subsubsection"]], "Input",
 CellChangeTimes->{{3.8181133862520227`*^9, 3.818113387136111*^9}},
 TextAlignment->Center],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"reflectRay", "[", 
    RowBox[{"ray_", ",", "normal_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{"ray", "-", 
     RowBox[{"2", 
      RowBox[{"Dot", "[", 
       RowBox[{"ray", ",", "normal"}], "]"}], "*", "normal"}]}], 
    "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"refract", "[", 
    RowBox[{"ray_", ",", "normal_", ",", "refractive_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Dot", "[", 
         RowBox[{"ray", ",", "normal"}], "]"}], ">", "0"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"r", "=", "refractive"}], ";", 
        RowBox[{"norm", "=", 
         RowBox[{"-", "normal"}]}], ";"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"r", "=", 
         RowBox[{"1", "/", "refractive"}]}], ";", 
        RowBox[{"norm", "=", "normal"}], ";"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"uv", "=", 
      RowBox[{"Normalize", "[", "ray", "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"dt", "=", 
      RowBox[{"Dot", "[", 
       RowBox[{"uv", ",", "norm"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"discriminant", "=", 
      RowBox[{"1", "-", 
       RowBox[{
        SuperscriptBox["r", "2"], 
        RowBox[{"(", 
         RowBox[{"1", "-", 
          SuperscriptBox["dt", "2"]}], ")"}]}]}]}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"discriminant", ">", "0"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"r", 
         RowBox[{"(", 
          RowBox[{"uv", "-", 
           RowBox[{"norm", " ", "dt"}]}], ")"}]}], "-", 
        RowBox[{"norm", " ", 
         SqrtBox["discriminant"]}]}], "\[IndentingNewLine]", ",", "  ", 
       "\[IndentingNewLine]", 
       RowBox[{"reflectRay", "[", 
        RowBox[{"ray", ",", "norm"}], "]"}]}], "  ", "\[IndentingNewLine]", 
      "\n", "]"}]}], "\[IndentingNewLine]", ")"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"hitResult", "[", 
    RowBox[{"start_", ",", "end_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
    "(*", "\:5224\:65ad\:5149\:7ebf\:662f\:5426\:78b0\:5230\:7269\:4f53", 
     "*)"}], "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"root", "=", "0"}], ";", "\[IndentingNewLine]", 
     RowBox[{"hitedObject", "=", 
      RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
      "\:904d\:5386\:4e16\:754c", "\:ff0c", 
       "\:8be2\:95ee\:6bcf\:4e2a\:7269\:4f53\:6709\:6ca1\:6709\:88ab\:5149\
\:7ebf\:51fb\:4e2d"}], "*)"}], "\[IndentingNewLine]", " ", 
     RowBox[{"Scan", "[", 
      RowBox[{
       RowBox[{"Function", "[", 
        RowBox[{"sphere", ",", 
         RowBox[{"(", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"a", "=", 
            RowBox[{
             RowBox[{"(", 
              RowBox[{"end", "-", "start"}], ")"}], ".", 
             RowBox[{"(", 
              RowBox[{"end", "-", "start"}], ")"}]}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"b", "=", 
            RowBox[{
             RowBox[{"2", 
              RowBox[{"(", 
               RowBox[{"start", ".", 
                RowBox[{"(", 
                 RowBox[{"end", "-", "start"}], ")"}]}], ")"}]}], "-", 
             RowBox[{"2", 
              RowBox[{"(", 
               RowBox[{
                RowBox[{"(", 
                 RowBox[{"end", "-", "start"}], ")"}], ".", 
                RowBox[{"sphere", "[", 
                 RowBox[{"[", "1", "]"}], "]"}]}], ")"}]}]}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"c", "=", 
            RowBox[{
             RowBox[{"start", ".", "start"}], "-", 
             RowBox[{"2", 
              RowBox[{"(", 
               RowBox[{"start", ".", 
                RowBox[{"sphere", "[", 
                 RowBox[{"[", "1", "]"}], "]"}]}], ")"}]}], "+", 
             RowBox[{
              RowBox[{"sphere", "[", 
               RowBox[{"[", "1", "]"}], "]"}], ".", 
              RowBox[{"sphere", "[", 
               RowBox[{"[", "1", "]"}], "]"}]}], "-", 
             SuperscriptBox[
              RowBox[{"sphere", "[", 
               RowBox[{"[", "2", "]"}], "]"}], "2"]}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"If", "[", 
            RowBox[{
             RowBox[{
              RowBox[{
               SuperscriptBox["b", "2"], "-", 
               RowBox[{"4", "a", " ", "c"}]}], ">", "0"}], ",", 
             RowBox[{
              RowBox[{"isHit", "=", " ", "True"}], ";", "\[IndentingNewLine]", 
              RowBox[{"rootA", "=", 
               FractionBox[
                RowBox[{
                 RowBox[{"-", "b"}], "-", 
                 SqrtBox[
                  RowBox[{
                   SuperscriptBox["b", "2"], "-", 
                   RowBox[{"4", "a", " ", "c"}]}]]}], 
                RowBox[{"2", "a"}]]}], ";", "\[IndentingNewLine]", 
              RowBox[{"rootB", "=", 
               FractionBox[
                RowBox[{
                 RowBox[{"-", "b"}], "+", 
                 SqrtBox[
                  RowBox[{
                   SuperscriptBox["b", "2"], "-", 
                   RowBox[{"4", "a", " ", "c"}]}]]}], 
                RowBox[{"2", "a"}]]}], ";", "\[IndentingNewLine]", 
              RowBox[{"If", "[", 
               RowBox[{
                RowBox[{"rootA", ">", 
                 RowBox[{"1", "*", 
                  SuperscriptBox["10", 
                   RowBox[{"-", "9"}]]}]}], ",", "\[IndentingNewLine]", 
                RowBox[{"If", "[", 
                 RowBox[{
                  RowBox[{
                   RowBox[{"root", "\[Equal]", "0"}], " ", "||", 
                   RowBox[{"root", ">", "rootA"}]}], ",", 
                  "\[IndentingNewLine]", 
                  RowBox[{
                   RowBox[{"hitedObject", "=", "sphere"}], ";", 
                   "\[IndentingNewLine]", 
                   RowBox[{"root", "=", "rootA"}], ";"}]}], 
                 "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}],
               ";", "\[IndentingNewLine]", 
              RowBox[{"If", "[", 
               RowBox[{
                RowBox[{"rootB", ">", 
                 RowBox[{"1", "*", 
                  SuperscriptBox["10", 
                   RowBox[{"-", "9"}]]}]}], ",", "\[IndentingNewLine]", 
                RowBox[{"If", "[", 
                 RowBox[{
                  RowBox[{
                   RowBox[{"root", "\[Equal]", "0"}], "  ", "||", " ", 
                   RowBox[{"root", ">", "rootB"}]}], ",", 
                  "\[IndentingNewLine]", 
                  RowBox[{
                   RowBox[{"hitedObject", "=", "sphere"}], ";", 
                   "\[IndentingNewLine]", 
                   RowBox[{"root", "=", "rootB"}], ";"}]}], 
                 "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}],
               ";"}]}], "\[IndentingNewLine]", "]"}]}], ")"}]}], "]"}], ",", 
       "world"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"root", "\[Equal]", "0"}], ",", 
       RowBox[{"isHit", "=", "False"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"isHit", "=", "True"}], ";", "\[IndentingNewLine]", 
        RowBox[{"hitPoint", "=", 
         RowBox[{"start", "+", 
          RowBox[{
           RowBox[{"(", 
            RowBox[{"end", "-", "start"}], ")"}], "*", "root"}]}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"normal", "=", 
         FractionBox[
          RowBox[{"hitPoint", "-", 
           RowBox[{"hitedObject", "[", 
            RowBox[{"[", "1", "]"}], "]"}]}], 
          RowBox[{"hitedObject", "[", 
           RowBox[{"[", "2", "]"}], "]"}]]}], ";"}]}], "\[IndentingNewLine]", 
      "]"}], ";"}], "\[IndentingNewLine]", ")"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"genRandomUnit", "[", "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
    "(*", "\:751f\:6210\:5355\:4f4d\:7403\:91cc\:7684\:968f\:673a\:5411\:91cf\
", "*)"}], "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"2", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"RandomReal", "[", "]"}], ",", 
        RowBox[{"RandomReal", "[", "]"}], ",", 
        RowBox[{"RandomReal", "[", "]"}]}], "}"}]}], "-", "1"}], 
    "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"genColor", "[", 
    RowBox[{"start_", ",", "end_", ",", "rayDepth_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
    "(*", "\:8fd4\:56de\:4e00\:7cfb\:5217\:5149\:7ebf\:5750\:6807", "*)"}], 
    "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"hitResult", "[", 
      RowBox[{"start", ",", "end"}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{"isHit", ",", "\[IndentingNewLine]", 
       RowBox[{"(*", "\:6cd5\:7ebf\:53ef\:89c6\:5316", "*)"}], 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"AppendTo", "[", 
         RowBox[{"result", ",", 
          RowBox[{"Style", "[", 
           RowBox[{
            RowBox[{"Arrow", "[", 
             RowBox[{"{", 
              RowBox[{"hitPoint", ",", 
               RowBox[{"normal", "+", "hitPoint"}]}], "}"}], "]"}], ",", 
            "Red"}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{
           RowBox[{"hitedObject", "[", 
            RowBox[{"[", "3", "]"}], "]"}], "\[Equal]", "\"\<metal\>\""}], 
          "\[IndentingNewLine]", ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"reflectedRay", "=", 
            RowBox[{"reflectRay", "[", 
             RowBox[{
              RowBox[{"end", "-", "start"}], ",", "normal"}], "]"}]}], ";"}], 
          "\[IndentingNewLine]", ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"reflectedRay", "=", 
            RowBox[{"refract", "[", 
             RowBox[{
              RowBox[{"end", "-", "start"}], ",", "normal", ",", 
              RowBox[{"hitedObject", "[", 
               RowBox[{"[", "6", "]"}], "]"}]}], "]"}]}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"AppendTo", "[", 
         RowBox[{"lines", ",", "hitPoint"}], "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{"rayDepth", "<", "3"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"genColor", "[", 
            RowBox[{"hitPoint", ",", 
             RowBox[{"reflectedRay", "+", "hitPoint"}], ",", 
             RowBox[{"rayDepth", "+", "1"}]}], "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{"reflectedRay", "\[NotEqual]", 
           RowBox[{"{", "}"}]}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"AppendTo", "[", 
            RowBox[{"lines", ",", 
             RowBox[{"reflectedRay", "+", "hitPoint"}]}], "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], 
     ";"}], "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"u", "[", "x_", "]"}], ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"upperLeft", "[", 
      RowBox[{"[", "1", "]"}], "]"}], "+", 
     FractionBox[
      RowBox[{
       RowBox[{"Norm", "[", 
        RowBox[{"lowerLeft", "-", "lowerRight"}], "]"}], "*", "x"}], 
      "width"]}], ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"v", "[", "y_", "]"}], ":=", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"upperLeft", "[", 
      RowBox[{"[", "2", "]"}], "]"}], "-", 
     FractionBox[
      RowBox[{
       RowBox[{"Norm", "[", 
        RowBox[{"lowerLeft", "-", "upperLeft"}], "]"}], "*", "y"}], 
      "height"]}], ")"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"scanScreen", "[", 
    RowBox[{"y_", ",", "x_"}], "]"}], ":=", 
   RowBox[{"(", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"lines", ":=", 
      RowBox[{"{", 
       RowBox[{"{", 
        RowBox[{"0", ",", "0", ",", "0"}], "}"}], "}"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"result", ":=", 
      RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"reflectedRay", "=", 
      RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
      "\:626b\:63cf\:51fd\:6570", "\:ff0c", 
       "\:8d1f\:8d23\:9010\:4e2a\:50cf\:7d20\:904d\:5386", ",", 
       "xy\:662f\:5c4f\:5e55\:5750\:6807", "\:ff0c", 
       "\:9700\:8f6c\:6362\:4e3a\:4e16\:754c\:5750\:6807uv"}], "*)"}], 
     "\[IndentingNewLine]", 
     RowBox[{"AppendTo", "[", 
      RowBox[{"result", ",", 
       RowBox[{"Arrow", "[", 
        RowBox[{"{", 
         RowBox[{"origin", ",", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"u", "[", "x", "]"}], ",", 
            RowBox[{"v", "[", "y", "]"}], ",", 
            RowBox[{"-", "1"}]}], "}"}]}], "}"}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"genColor", "[", 
      RowBox[{"origin", ",", 
       RowBox[{"{", 
        RowBox[{
         RowBox[{"u", "[", "x", "]"}], ",", 
         RowBox[{"v", "[", "y", "]"}], ",", 
         RowBox[{"-", "1"}]}], "}"}], ",", "0"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"AppendTo", "[", 
      RowBox[{"result", ",", 
       RowBox[{"Arrow", "[", "lines", "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", "result"}], "\[IndentingNewLine]", ")"}]}], 
  ";"}]}], "Input",
 CellChangeTimes->{{3.818113336250023*^9, 3.818113336596057*^9}, {
   3.818114079535344*^9, 3.818114184514841*^9}, 3.8181142383502235`*^9, {
   3.8181143068820763`*^9, 3.8181143237967677`*^9}, {3.8181143636847563`*^9, 
   3.8181144513845253`*^9}, {3.8181144891032963`*^9, 
   3.8181144905724435`*^9}, {3.818114565236909*^9, 3.818114581006486*^9}, {
   3.8181146853919234`*^9, 3.8181147071450987`*^9}, {3.818114888131195*^9, 
   3.81811489348073*^9}, {3.8181150060949907`*^9, 3.818115012170598*^9}, {
   3.818115066316012*^9, 3.8181151094553256`*^9}, {3.81811549283666*^9, 
   3.8181155028746634`*^9}, {3.8181156751278872`*^9, 
   3.8181157366190357`*^9}, {3.8181160681948023`*^9, 3.818116079223699*^9}, {
   3.818116141189*^9, 3.8181161497869997`*^9}, {3.818116203999*^9, 
   3.8181162934230003`*^9}, {3.8181166181371927`*^9, 3.818116627364115*^9}, {
   3.81812177528086*^9, 3.8181217791542473`*^9}, {3.818128138645152*^9, 
   3.818128139446232*^9}, {3.8181282908593717`*^9, 3.818128292535539*^9}, {
   3.8181283355178375`*^9, 3.818128405597844*^9}, {3.818128450980382*^9, 
   3.81812852066635*^9}, 3.8181285616134443`*^9, 3.8181286391011925`*^9, {
   3.818128673239606*^9, 3.81812867438172*^9}, {3.8181287293212137`*^9, 
   3.818128733405622*^9}, {3.818128918699149*^9, 3.8181289454648256`*^9}, {
   3.818128986052884*^9, 3.818129006524931*^9}, {3.81812969658393*^9, 
   3.81812970548482*^9}, {3.8181297508323545`*^9, 3.81812978419569*^9}, {
   3.818129827443015*^9, 3.8181298320404744`*^9}, {3.8181298922984996`*^9, 
   3.818129896628933*^9}, {3.8181301261788855`*^9, 3.818130128072075*^9}, {
   3.8181302060188684`*^9, 3.818130210883355*^9}, {3.8181304686129303`*^9, 
   3.8181305100289297`*^9}, {3.8181306242776947`*^9, 
   3.8181306512353907`*^9}, {3.818130977871051*^9, 3.818131004279691*^9}, 
   3.8181310566379266`*^9, {3.8181310887411366`*^9, 3.818131090324295*^9}, {
   3.8181311242746897`*^9, 3.8181312396042213`*^9}, {3.818131289554216*^9, 
   3.818131313119572*^9}, {3.8181314383510942`*^9, 3.8181314918734455`*^9}, {
   3.8181315480730653`*^9, 3.8181315784010973`*^9}, 3.818131629637221*^9, 
   3.8181316652877855`*^9, 3.8181317014464006`*^9, 3.8181321343106833`*^9, 
   3.8181322407273235`*^9, {3.8181322844356937`*^9, 3.818132284807731*^9}, {
   3.8181331584680886`*^9, 3.818133165910833*^9}, {3.8181334639586344`*^9, 
   3.8181335030615444`*^9}, 3.818133569839222*^9, 3.8181336159008274`*^9, {
   3.8181340332479115`*^9, 3.818134036071911*^9}, 3.8181340975729113`*^9, {
   3.8181352424194727`*^9, 3.8181352704212723`*^9}, {3.818135459780206*^9, 
   3.8181354663538637`*^9}, {3.818135787184943*^9, 3.818135821663391*^9}, {
   3.8181358579350176`*^9, 3.81813589585981*^9}, {3.818136565773794*^9, 
   3.818136592212438*^9}, {3.8181372866428742`*^9, 3.818137302261436*^9}, {
   3.818137367816991*^9, 3.8181373967948885`*^9}, {3.8181374583988943`*^9, 
   3.818137463782894*^9}, {3.818137690117894*^9, 3.818137700533894*^9}, {
   3.818137730741894*^9, 3.8181377772038937`*^9}, 3.818137845418894*^9, {
   3.8181379254458942`*^9, 3.818137947315352*^9}, {3.8181379900956297`*^9, 
   3.8181379915717773`*^9}, {3.818138342627879*^9, 3.818138365686185*^9}, {
   3.8181384320978255`*^9, 3.818138449282544*^9}, {3.8181384797925944`*^9, 
   3.8181384833229475`*^9}, {3.818138786714284*^9, 3.8181387944340553`*^9}, {
   3.818138827810393*^9, 3.8181388732319345`*^9}, {3.8181389733429446`*^9, 
   3.818138993819992*^9}, {3.8181390700516143`*^9, 3.818139093494959*^9}, {
   3.81819996558214*^9, 3.818199972821692*^9}, {3.8182001040402155`*^9, 
   3.8182003531652155`*^9}, {3.818200409656215*^9, 3.8182005666149573`*^9}, {
   3.8182006837866735`*^9, 3.8182007259058847`*^9}, {3.8182023831285906`*^9, 
   3.8182023835876365`*^9}, 3.8182030158228807`*^9, {3.8182032877518806`*^9, 
   3.818203317792057*^9}, {3.818203349838261*^9, 3.8182033820334806`*^9}, 
   3.818203625140789*^9, 3.8182082746066985`*^9, {3.818208327347972*^9, 
   3.8182084850937448`*^9}, {3.8182085629985347`*^9, 3.8182085652637615`*^9}, 
   3.8182087527485075`*^9, 3.818208818211053*^9, {3.8182089390931406`*^9, 
   3.8182089850117316`*^9}, {3.818209215737802*^9, 3.8182092438526134`*^9}, 
   3.8182096600172253`*^9, 3.8182097288461075`*^9, 3.818210198556079*^9, 
   3.8182102939766197`*^9, {3.8182130069758925`*^9, 3.8182130078439794`*^9}, 
   3.8182130412243176`*^9, {3.818213789119828*^9, 3.818213789911828*^9}, {
   3.8182138439488277`*^9, 3.8182138651578283`*^9}, {3.818213960019828*^9, 
   3.818213967027828*^9}, {3.818214027411828*^9, 3.818214028976828*^9}, {
   3.818214065067828*^9, 3.8182141974989424`*^9}, {3.8182143161208034`*^9, 
   3.818214335600751*^9}, {3.818282563321349*^9, 3.818282569453595*^9}, {
   3.8182888379693933`*^9, 3.8182888679563913`*^9}, {3.8182889151401095`*^9, 
   3.818288917714367*^9}, {3.8182890074583406`*^9, 3.8182890126618605`*^9}, {
   3.818304210769562*^9, 3.8183042148669715`*^9}, {3.8183069951589727`*^9, 
   3.8183070251629734`*^9}, {3.8183070937818346`*^9, 
   3.8183070953649926`*^9}, {3.818307582907747*^9, 3.8183076057790337`*^9}, {
   3.819084665982859*^9, 3.8190846680330644`*^9}, {3.820631215718831*^9, 
   3.8206312982820864`*^9}, 3.8206313298692446`*^9, 3.8206314981450706`*^9, {
   3.820631609530208*^9, 3.820631756020856*^9}, {3.8206318337646294`*^9, 
   3.820631839513204*^9}, {3.820631899039156*^9, 3.8206319401312647`*^9}, {
   3.8206322164338923`*^9, 3.8206322253817873`*^9}, {3.8206323551317606`*^9, 
   3.820632356356883*^9}, {3.8206324978830347`*^9, 3.8206325236066065`*^9}, {
   3.8206325873049755`*^9, 3.820632600856331*^9}, {3.820632637552*^9, 
   3.8206326399152365`*^9}, 3.8206326749877434`*^9, {3.820632723440588*^9, 
   3.820632723884632*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 StyleBox["\:5149\:7ebf\:53ef\:89c6\:5316", "Subsection"]], "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10002.},
 CellChangeTimes->{{3.8173379409549494`*^9, 3.8173379763469496`*^9}, 
   3.817348546926899*^9, 3.8174156245745373`*^9, {3.817415663231971*^9, 
   3.817415673960292*^9}, {3.818113279878386*^9, 3.8181132811435127`*^9}},
 TextAlignment->Center],

Cell[BoxData[
 RowBox[{"Manipulate", "[", "\[IndentingNewLine]", 
  RowBox[{
   RowBox[{"Graphics3D", "[", 
    RowBox[{
     RowBox[{"{", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"Arrowheads", "[", "Small", "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"Cuboid", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"-", "0.1"}], ",", 
           RowBox[{"-", "0.1"}], ",", "0.1"}], "}"}], ",", 
         RowBox[{"{", 
          RowBox[{"0.1", ",", "0.1", ",", 
           RowBox[{"-", "0.1"}]}], "}"}]}], "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"Style", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Opacity", "[", ".3", "]"}], ",", 
           RowBox[{"Sphere", "[", 
            RowBox[{
             RowBox[{"sphere1", "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{"sphere1", "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "}"}], ",", "Blue"}],
         "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"Style", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Opacity", "[", ".5", "]"}], ",", 
           RowBox[{"Sphere", "[", 
            RowBox[{
             RowBox[{"sphere2", "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{"sphere2", "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "}"}], ",", 
         RowBox[{"RGBColor", "[", 
          RowBox[{"sphere2", "[", 
           RowBox[{"[", "5", "]"}], "]"}], "]"}]}], "]"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"Style", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Opacity", "[", ".5", "]"}], ",", 
           RowBox[{"Sphere", "[", 
            RowBox[{
             RowBox[{"sphere3", "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{"sphere3", "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "}"}], ",", 
         RowBox[{"RGBColor", "[", 
          RowBox[{"sphere3", "[", 
           RowBox[{"[", "5", "]"}], "]"}], "]"}]}], "]"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"Style", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Opacity", "[", "1", "]"}], ",", 
           RowBox[{"Sphere", "[", 
            RowBox[{
             RowBox[{"sphere0", "[", 
              RowBox[{"[", "1", "]"}], "]"}], ",", 
             RowBox[{"sphere0", "[", 
              RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], "}"}], ",", 
         RowBox[{"RGBColor", "[", 
          RowBox[{"sphere0", "[", 
           RowBox[{"[", "5", "]"}], "]"}], "]"}]}], "]"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"scanScreen", "[", 
        RowBox[{"y", ",", "x"}], "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"Opacity", "[", ".3", "]"}], ",", 
       RowBox[{"Polygon", "[", 
        RowBox[{"{", 
         RowBox[{
         "upperLeft", ",", "lowerLeft", ",", "lowerRight", ",", 
          "upperRight"}], "}"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", 
     RowBox[{"Axes", "\[Rule]", "True"}], ",", 
     RowBox[{"PlotRange", "\[Rule]", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "3"}], ",", "3"}], "}"}], ",", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "2"}], ",", "2"}], "}"}], ",", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "3"}], ",", "1"}], "}"}]}], "}"}]}]}], 
    "\[IndentingNewLine]", "]"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", "0", ",", "width"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"y", ",", "0", ",", "height"}], "}"}]}], "\[IndentingNewLine]", 
  "]"}]], "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10002.},
 CellChangeTimes->{{3.817333895641637*^9, 3.8173339709333687`*^9}, {
   3.81733401392829*^9, 3.8173340177603006`*^9}, {3.817334557001119*^9, 
   3.817334586799177*^9}, {3.8173346247757807`*^9, 3.8173346540459967`*^9}, 
   3.817334857444251*^9, {3.817334892441251*^9, 3.8173349357212505`*^9}, {
   3.8173349706662507`*^9, 3.817335027612251*^9}, {3.8173350973042507`*^9, 
   3.817335128815251*^9}, {3.817335237379274*^9, 3.8173352935398893`*^9}, {
   3.8173353316346984`*^9, 3.8173353889424286`*^9}, {3.8173354748080144`*^9, 
   3.81733555447298*^9}, 3.817335591787711*^9, {3.817335626826215*^9, 
   3.8173356328068123`*^9}, {3.817335695044036*^9, 3.8173357361971507`*^9}, {
   3.8173357673772683`*^9, 3.817335801774708*^9}, {3.817335887846314*^9, 
   3.8173359354990788`*^9}, {3.8173359818987184`*^9, 
   3.8173360571442423`*^9}, {3.8173361918207083`*^9, 3.817336238160342*^9}, 
   3.817336489739497*^9, 3.8173379763469496`*^9, {3.8173477193833776`*^9, 
   3.817347732861725*^9}, {3.8173477883302717`*^9, 3.8173478044988885`*^9}, 
   3.817348546927899*^9, {3.8173490648879194`*^9, 3.817349121790609*^9}, {
   3.817349174255855*^9, 3.8173492572001486`*^9}, {3.817349330670495*^9, 
   3.817349335480976*^9}, {3.8173495632617517`*^9, 3.817349602256651*^9}, {
   3.8173497379652205`*^9, 3.8173497419396176`*^9}, 3.81735012210063*^9, {
   3.8173501700124207`*^9, 3.8173501825916786`*^9}, {3.8173502510995283`*^9, 
   3.817350260349454*^9}, {3.8173506229087057`*^9, 3.8173506516575804`*^9}, {
   3.8173508048919024`*^9, 3.8173508274891615`*^9}, {3.8173541353049245`*^9, 
   3.8173541904474382`*^9}, {3.8173542294453373`*^9, 3.817354281702563*^9}, {
   3.817354479236314*^9, 3.8173545032827187`*^9}, {3.8173545508454742`*^9, 
   3.8173546698063693`*^9}, {3.8173586305744114`*^9, 3.817358633190673*^9}, {
   3.817358764258778*^9, 3.817358828873239*^9}, 3.8174156245745373`*^9, {
   3.817415663231971*^9, 3.817415673961315*^9}, {3.8174179924214516`*^9, 
   3.8174179957276134`*^9}, 3.81741980884787*^9, {3.8174198443405056`*^9, 
   3.8174198498571787`*^9}, {3.817510793124935*^9, 3.8175107956651893`*^9}, {
   3.817510856418264*^9, 3.817510913024372*^9}, 3.8175109827803965`*^9, {
   3.8175111544412284`*^9, 3.817511196139058*^9}, {3.81751134795365*^9, 
   3.81751145206365*^9}, {3.81751149240565*^9, 3.817511569931622*^9}, {
   3.817511627843413*^9, 3.8175116704146695`*^9}, {3.8175246484103627`*^9, 
   3.8175246499425163`*^9}, {3.8175247857690973`*^9, 
   3.8175248080953293`*^9}, {3.817526853203825*^9, 3.8175268558920937`*^9}, 
   3.8175335319660587`*^9, {3.817598243487692*^9, 3.817598247741692*^9}, {
   3.817598312353692*^9, 3.817598313978692*^9}, {3.817691969752584*^9, 
   3.817692004167025*^9}, {3.8176925334699497`*^9, 3.8176925493175344`*^9}, {
   3.8176925814457474`*^9, 3.8176927274443455`*^9}, {3.8177776884141254`*^9, 
   3.817777754646285*^9}, {3.8177777940862284`*^9, 3.8177778092997494`*^9}, {
   3.8177791123100376`*^9, 3.8177791717229786`*^9}, {3.817794339392627*^9, 
   3.817794380659753*^9}, {3.8178503757329893`*^9, 3.817850389354989*^9}, {
   3.8179593795623074`*^9, 3.8179593869720483`*^9}, {3.8179594897443247`*^9, 
   3.817959506953045*^9}, {3.8179595416005096`*^9, 3.8179595928336325`*^9}, 
   3.817964695983906*^9, {3.8179648017314796`*^9, 3.8179648064889555`*^9}, {
   3.817964875764882*^9, 3.8179649006643715`*^9}, {3.8179649371834154`*^9, 
   3.8179649555474157`*^9}, {3.8179654080171065`*^9, 
   3.8179654622805324`*^9}, {3.8179659928335824`*^9, 
   3.8179659990172005`*^9}, {3.8179663889031854`*^9, 3.817966395474842*^9}, {
   3.817967441593444*^9, 3.8179674670259867`*^9}, {3.8179675443417177`*^9, 
   3.8179675499002733`*^9}, {3.8181100156108475`*^9, 
   3.8181100230478473`*^9}, {3.818110107505847*^9, 3.8181101238898473`*^9}, {
   3.818110287098138*^9, 3.818110425062933*^9}, 3.8181104582692537`*^9, {
   3.818110683594784*^9, 3.8181107184802723`*^9}, {3.818111051855606*^9, 
   3.818111096009021*^9}, {3.818111357713189*^9, 3.8181113948459015`*^9}, {
   3.8181125448278885`*^9, 3.8181125716895742`*^9}, {3.8181126206574707`*^9, 
   3.8181126738607903`*^9}, {3.8181135731977153`*^9, 
   3.8181136002834234`*^9}, {3.8181145396493506`*^9, 3.818114540172403*^9}, {
   3.8181318247227273`*^9, 3.818131856116866*^9}, {3.8182131370598993`*^9, 
   3.8182131456887627`*^9}, {3.820631366005858*^9, 3.8206313995552125`*^9}, {
   3.820631432992556*^9, 3.8206314674680033`*^9}, {3.8206318661918716`*^9, 
   3.8206318830305552`*^9}}]
}, Open  ]],

Cell[BoxData[
 TagBox[
  StyleBox[
   DynamicModuleBox[{$CellContext`x$$ = 26., $CellContext`y$$ = 17.3, 
    Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, 
    Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 
    1, Typeset`name$$ = "\"\:65e0\:6807\:9898\"", Typeset`specs$$ = {{
      Hold[$CellContext`x$$], 0, 120}, {
      Hold[$CellContext`y$$], 0, 60}}, Typeset`size$$ = {490., {208., 217.}}, 
    Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = 
    True, $CellContext`x$6149$$ = 0, $CellContext`y$6150$$ = 0}, 
    DynamicBox[Manipulate`ManipulateBoxes[
     1, StandardForm, 
      "Variables" :> {$CellContext`x$$ = 0, $CellContext`y$$ = 0}, 
      "ControllerVariables" :> {
        Hold[$CellContext`x$$, $CellContext`x$6149$$, 0], 
        Hold[$CellContext`y$$, $CellContext`y$6150$$, 0]}, 
      "OtherVariables" :> {
       Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, 
        Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, 
        Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$,
         Typeset`skipInitDone$$}, "Body" :> Graphics3D[{
         Arrowheads[Small], 
         Cuboid[{-0.1, -0.1, 0.1}, {0.1, 0.1, -0.1}], 
         Style[{
           Opacity[0.3], 
           Sphere[
            Part[$CellContext`sphere1, 1], 
            Part[$CellContext`sphere1, 2]]}, Blue], 
         Style[{
           Opacity[0.5], 
           Sphere[
            Part[$CellContext`sphere2, 1], 
            Part[$CellContext`sphere2, 2]]}, 
          RGBColor[
           Part[$CellContext`sphere2, 5]]], 
         Style[{
           Opacity[0.5], 
           Sphere[
            Part[$CellContext`sphere3, 1], 
            Part[$CellContext`sphere3, 2]]}, 
          RGBColor[
           Part[$CellContext`sphere3, 5]]], 
         Style[{
           Opacity[1], 
           Sphere[
            Part[$CellContext`sphere0, 1], 
            Part[$CellContext`sphere0, 2]]}, 
          RGBColor[
           Part[$CellContext`sphere0, 5]]], 
         $CellContext`scanScreen[$CellContext`y$$, $CellContext`x$$], 
         Opacity[0.3], 
         Polygon[{$CellContext`upperLeft, $CellContext`lowerLeft, \
$CellContext`lowerRight, $CellContext`upperRight}]}, Axes -> True, 
        PlotRange -> {{-3, 3}, {-2, 2}, {-3, 1}}], 
      "Specifications" :> {{$CellContext`x$$, 0, 120}, {$CellContext`y$$, 0, 
         60}}, "Options" :> {}, "DefaultOptions" :> {}],
     ImageSizeCache->{553., {279., 288.}},
     SingleEvaluation->True],
    Deinitialization:>None,
    DynamicModuleValues:>{},
    SynchronousInitialization->True,
    UndoTrackedVariables:>{Typeset`show$$, Typeset`bookmarkMode$$},
    UnsavedVariables:>{Typeset`initDone$$},
    UntrackedVariables:>{Typeset`size$$}], "Manipulate",
   Deployed->True,
   StripOnInput->False],
  Manipulate`InterpretManipulate[1]]], "Output",
 CellChangeTimes->{{3.8181126491013145`*^9, 3.8181126753459387`*^9}, 
   3.8181127296903725`*^9, 3.8181127840138044`*^9, 3.818112817892192*^9, 
   3.818112949343336*^9, {3.818113019212322*^9, 3.8181130685142517`*^9}, 
   3.8181131306614656`*^9, {3.818113165126912*^9, 3.81811318851025*^9}, 
   3.81811335112651*^9, {3.81811357665106*^9, 3.818113601000495*^9}, {
   3.818114400711458*^9, 3.8181144548968763`*^9}, 3.8181144944358296`*^9, 
   3.818114540875473*^9, 3.8181145892893143`*^9, 3.8181150160629873`*^9, 
   3.818115113193699*^9, 3.8181166315345325`*^9, 3.818128540302314*^9, 
   3.8181290588401623`*^9, {3.8181301510063677`*^9, 3.818130165288796*^9}, {
   3.8181310282950926`*^9, 3.818131046230886*^9}, 3.8181314491881776`*^9, 
   3.818131554028661*^9, {3.818131829335189*^9, 3.818131856672922*^9}, 
   3.818133580176255*^9, 3.8181336241746545`*^9, 3.8181352804842787`*^9, 
   3.8181353210583353`*^9, 3.818137469296894*^9, 3.818203139315881*^9, 
   3.818213147636957*^9, 3.818288875923188*^9, 3.818288958237419*^9, 
   3.8183070339728537`*^9, 3.8190848378010397`*^9, {3.8206318457308254`*^9, 
   3.820631901472399*^9}, 3.8206319430685587`*^9, 3.8206320664908996`*^9, {
   3.820632615888834*^9, 3.8206326440366488`*^9}, 3.820632729868231*^9}]
},
WindowToolbars->"EditBar",
WindowSize->{934, 810},
WindowMargins->{{Automatic, 0}, {Automatic, 0}},
CellContext->Notebook,
Magnification:>1.3 Inherited,
FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (2016\:5e7410\:67088\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 550, 9, 96, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10000.}],
Cell[CellGroupData[{
Cell[1133, 33, 425, 7, 49, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.}],
Cell[1561, 42, 7504, 172, 540, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10001.}]
}, Open  ]],
Cell[9080, 217, 171, 3, 49, "Input"],
Cell[9254, 222, 19531, 435, 3233, "Input"],
Cell[CellGroupData[{
Cell[28810, 661, 379, 6, 49, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10002.}],
Cell[29192, 669, 8246, 162, 560, "Input",
 CellGroupingRules->{"GroupTogetherGrouping", 10002.}]
}, Open  ]],
Cell[37453, 834, 4143, 84, 588, "Output"]
}
]
*)

